// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
use crate::Result;

/// Implements a [ManagedKafka](super::stub::ManagedKafka) decorator for logging and tracing.
#[derive(Clone, Debug)]
pub struct ManagedKafka<T>
where
    T: super::stub::ManagedKafka + std::fmt::Debug + Send + Sync,
{
    inner: T,
}

impl<T> ManagedKafka<T>
where
    T: super::stub::ManagedKafka + std::fmt::Debug + Send + Sync,
{
    pub fn new(inner: T) -> Self {
        Self { inner }
    }
}

impl<T> super::stub::ManagedKafka for ManagedKafka<T>
where
    T: super::stub::ManagedKafka + std::fmt::Debug + Send + Sync,
{
    #[tracing::instrument(ret)]
    async fn list_clusters(
        &self,
        req: crate::model::ListClustersRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListClustersResponse>> {
        self.inner.list_clusters(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_cluster(
        &self,
        req: crate::model::GetClusterRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Cluster>> {
        self.inner.get_cluster(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_cluster(
        &self,
        req: crate::model::CreateClusterRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_cluster(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_cluster(
        &self,
        req: crate::model::UpdateClusterRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_cluster(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_cluster(
        &self,
        req: crate::model::DeleteClusterRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_cluster(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_topics(
        &self,
        req: crate::model::ListTopicsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListTopicsResponse>> {
        self.inner.list_topics(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_topic(
        &self,
        req: crate::model::GetTopicRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Topic>> {
        self.inner.get_topic(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_topic(
        &self,
        req: crate::model::CreateTopicRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Topic>> {
        self.inner.create_topic(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_topic(
        &self,
        req: crate::model::UpdateTopicRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Topic>> {
        self.inner.update_topic(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_topic(
        &self,
        req: crate::model::DeleteTopicRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_topic(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_consumer_groups(
        &self,
        req: crate::model::ListConsumerGroupsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListConsumerGroupsResponse>> {
        self.inner.list_consumer_groups(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_consumer_group(
        &self,
        req: crate::model::GetConsumerGroupRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ConsumerGroup>> {
        self.inner.get_consumer_group(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_consumer_group(
        &self,
        req: crate::model::UpdateConsumerGroupRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ConsumerGroup>> {
        self.inner.update_consumer_group(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_consumer_group(
        &self,
        req: crate::model::DeleteConsumerGroupRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_consumer_group(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_acls(
        &self,
        req: crate::model::ListAclsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListAclsResponse>> {
        self.inner.list_acls(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_acl(
        &self,
        req: crate::model::GetAclRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Acl>> {
        self.inner.get_acl(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_acl(
        &self,
        req: crate::model::CreateAclRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Acl>> {
        self.inner.create_acl(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_acl(
        &self,
        req: crate::model::UpdateAclRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Acl>> {
        self.inner.update_acl(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_acl(
        &self,
        req: crate::model::DeleteAclRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_acl(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn add_acl_entry(
        &self,
        req: crate::model::AddAclEntryRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::AddAclEntryResponse>> {
        self.inner.add_acl_entry(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn remove_acl_entry(
        &self,
        req: crate::model::RemoveAclEntryRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::RemoveAclEntryResponse>> {
        self.inner.remove_acl_entry(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_locations(
        &self,
        req: location::model::ListLocationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<location::model::ListLocationsResponse>> {
        self.inner.list_locations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_location(
        &self,
        req: location::model::GetLocationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<location::model::Location>> {
        self.inner.get_location(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_operations(
        &self,
        req: longrunning::model::ListOperationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::ListOperationsResponse>> {
        self.inner.list_operations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_operation(
        &self,
        req: longrunning::model::GetOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.get_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_operation(
        &self,
        req: longrunning::model::DeleteOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn cancel_operation(
        &self,
        req: longrunning::model::CancelOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.cancel_operation(req, options).await
    }

    fn get_polling_error_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_error_policy::PollingErrorPolicy> {
        self.inner.get_polling_error_policy(options)
    }

    fn get_polling_backoff_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
        self.inner.get_polling_backoff_policy(options)
    }
}

/// Implements a [ManagedKafkaConnect](super::stub::ManagedKafkaConnect) decorator for logging and tracing.
#[derive(Clone, Debug)]
pub struct ManagedKafkaConnect<T>
where
    T: super::stub::ManagedKafkaConnect + std::fmt::Debug + Send + Sync,
{
    inner: T,
}

impl<T> ManagedKafkaConnect<T>
where
    T: super::stub::ManagedKafkaConnect + std::fmt::Debug + Send + Sync,
{
    pub fn new(inner: T) -> Self {
        Self { inner }
    }
}

impl<T> super::stub::ManagedKafkaConnect for ManagedKafkaConnect<T>
where
    T: super::stub::ManagedKafkaConnect + std::fmt::Debug + Send + Sync,
{
    #[tracing::instrument(ret)]
    async fn list_connect_clusters(
        &self,
        req: crate::model::ListConnectClustersRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListConnectClustersResponse>> {
        self.inner.list_connect_clusters(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_connect_cluster(
        &self,
        req: crate::model::GetConnectClusterRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ConnectCluster>> {
        self.inner.get_connect_cluster(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_connect_cluster(
        &self,
        req: crate::model::CreateConnectClusterRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_connect_cluster(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_connect_cluster(
        &self,
        req: crate::model::UpdateConnectClusterRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_connect_cluster(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_connect_cluster(
        &self,
        req: crate::model::DeleteConnectClusterRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.delete_connect_cluster(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_connectors(
        &self,
        req: crate::model::ListConnectorsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListConnectorsResponse>> {
        self.inner.list_connectors(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_connector(
        &self,
        req: crate::model::GetConnectorRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Connector>> {
        self.inner.get_connector(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_connector(
        &self,
        req: crate::model::CreateConnectorRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Connector>> {
        self.inner.create_connector(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_connector(
        &self,
        req: crate::model::UpdateConnectorRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Connector>> {
        self.inner.update_connector(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_connector(
        &self,
        req: crate::model::DeleteConnectorRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_connector(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn pause_connector(
        &self,
        req: crate::model::PauseConnectorRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::PauseConnectorResponse>> {
        self.inner.pause_connector(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn resume_connector(
        &self,
        req: crate::model::ResumeConnectorRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ResumeConnectorResponse>> {
        self.inner.resume_connector(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn restart_connector(
        &self,
        req: crate::model::RestartConnectorRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::RestartConnectorResponse>> {
        self.inner.restart_connector(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn stop_connector(
        &self,
        req: crate::model::StopConnectorRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::StopConnectorResponse>> {
        self.inner.stop_connector(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_locations(
        &self,
        req: location::model::ListLocationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<location::model::ListLocationsResponse>> {
        self.inner.list_locations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_location(
        &self,
        req: location::model::GetLocationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<location::model::Location>> {
        self.inner.get_location(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_operations(
        &self,
        req: longrunning::model::ListOperationsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::ListOperationsResponse>> {
        self.inner.list_operations(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_operation(
        &self,
        req: longrunning::model::GetOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.get_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_operation(
        &self,
        req: longrunning::model::DeleteOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_operation(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn cancel_operation(
        &self,
        req: longrunning::model::CancelOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.cancel_operation(req, options).await
    }

    fn get_polling_error_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_error_policy::PollingErrorPolicy> {
        self.inner.get_polling_error_policy(options)
    }

    fn get_polling_backoff_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
        self.inner.get_polling_backoff_policy(options)
    }
}
